package sample;

import com.lcx.core.HandleCore;
import com.lcx.core.Scanner;
import com.lcx.util.WebLoadUtil;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

import java.net.URL;
import java.util.ResourceBundle;

public class Controller implements Initializable {

    @FXML
    private WebView webView;

    private WebEngine webEngine;

    @Override
    public void initialize(URL location, ResourceBundle resources) {

        Scanner.addOutScannerPath("ToBase64/target/ToBase64-1.0-SNAPSHOT.jar");
        Scanner.addOutScannerPath("MySqlHandle/target/My-SqlHandle-1.0-SNAPSHOT.jar");
//        Scanner.addOutScannerPath("lib/fxWeb.jar");
//        Scanner.addOutScannerPath("plug-in");

        webView.setContextMenuEnabled(false);
        webEngine = webView.getEngine();
        HandleCore handleCore = new HandleCore(webEngine,Controller.class);
        handleCore.setStage(Scanner.getBean(Stage.class));
        handleCore.init();

        webEngine.load(WebLoadUtil.getUrl("/html/index.html"));
    }
}
